package com.liner.string;

/**
 * String 和 StringBuilder 的对比
 */
public class StringStringBuilderDemo {
    public static void main(String[] args) {

        /**
         * String 不适合频繁修改内容，效率低
         * StirngBuilder 线程不安全  适合频繁修改内容
         */
      /*  for (int i = 0; i < 10000000; i++) {

        String s = "a";
            s = s + i;
        }
        System.out.println("执行完毕");
*/

        StringBuilder stringBuilder = new StringBuilder("a");
        for (int i = 0; i < 10000000; i++) {
            stringBuilder.append(i);
        }
        System.out.println("执行完毕");


    }
}
